package com.situ.mall.juc;



public class AtomicTest1 {
    static Integer num = 0;
    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    // synchronized(Main.class) 互斥锁可以解决这个问题
                    System.out.println("thread name: " + Thread.currentThread().getName() + ":" + ++num);
                }
            }).start();
        }
    }
}

